﻿/*
* 作者:haojielyb
* 邮箱:haojielyb@qq.com
*/

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Threading.Tasks;

namespace Haojielyb.Swagger2md.Extensions
{
    public static class JsonExtension
    {
        public static string ToJson(this object obj)
        {
            var opt = new JsonSerializerOptions();
            opt.Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping;
            opt.WriteIndented = true;

            return JsonSerializer.Serialize(obj, opt);
        }
    }
}